home *** CD-ROM | disk | FTP | other *** search
- mv/cp/rm v1.1 - move, copy, or remove
- files in the style of Unix mv/cp/rm
-
- Copyright 1989 Edwin Hoogerbeets
-
- This code is freely redistributable as long as no charge other than
- reasonable copying fees is levied for it.
-
- Usage:
-
- mv [-cfix] [-] file1 file2
- mv [-cfix] [-] path1 [path2 ...] dir
- cp [-fimnx] [-] file1 file2
- cp [-fimnxrR] [-] path1 [path2 ...] dir
- rm [-cdfimrR] [-] path [path ...]
-
- Where path is either a file or a directory.
-
- Options:
-
- -c act like cp instead (as in "mv -c" means do a cp instead of mv)
-
- -d remove directories only if they are empty (as in AmigaDOS Delete)
-
- -f force quiet mode, overwriting destination files if necessary.
-
- -i force interactive mode
-
- -m act like mv instead
-
- -n do not copy file dates, comments and protections (use "n"ew dates..)
-
- -R same as -r
- -r recursively do directories as well (mv is always recursive)
-
- -x act like rm instead (I ran out of option letters, that's why...)
-
- - end of options (useful to remove a file whose name starts with
- a dash eg. "-d")
-
- Options f and i are mutually exclusive, with i taking precedence.
-
- Notes:
-
- Yes, a three in one program! It slices, it dices, it even does
- julienne fries!
-
- This version has the following features: [if I did not screw up :-]
-
- - file permissions, dates, and comments are also copied or moved
- by default (switchable)
- - supports arp wildcarding, but does not insist on it (see below)
- - moves across volumes are supported
- - directories can be moved or copied recursively, even across
- volumes
- - attempts to allocate a big enough buffer to be able to copy
- or move files in one pass (reduces thrashing and increases speed)
- - does not print the bloody "foobar...copied" message for each file
- (which also increases speed)
- - can detect when two files are on the same volume (even if an
- assigned name is given) and uses Rename instead of copying
- - honours the delete bit
- - supports "" as current directory (eg. mv df1:* "")
-
- This version has the following misfeatures:
-
- - if a copy or move fails, it does not remove any files whatsoever
- (maybe it is a feature, I do not know)
- - all options are available to all forms of this program, though
- some are not used by some forms. (hence the usage information
- above) No checks are done for non-useful options.
-
-
- that maybe Manx specific. (I don't have Lattice, so I don't really
- know!)
-
- The action performed depends on the executable's name. There are entries
- in the makefile to change the default name of the executables, if a
- different name is desired. Copy one executable to a different name to
- get a different action. The default action is to copy, since no files
- are removed and this is the least destructive option.
-
- There is a small test script for the Dillon/Drew shell (easily ported to
- other shells) to test almost everything I can think of. If you can get
- cp/rm/mv to guru, or at least do something wierd, please send me a test
- case for the script and I will fix it pronto!
-
- It is possible to get by with only one copy of the executable if you
- use a shell that supports aliases. The following aliases might be
- helpful:
-
- alias cp mv -c - mv is the single executable name
- alias rm mv -x - x for remove. (makes sense, eh??)
- alias delete mv -xd - act like AmigaDOS Delete command
- alias rmdir mv -xd - remove directory a la unix
- alias mv Mv - use the external mv/cp/rm command instead
- alias rm Rm of the built in one!
- alias cp Cp
-
- Wildcards:
-
- Wildcards (arp) are supported at the request of Monsieur Dan Schein.
- To access them, there are appropriate spots in the makefile to define
- their use (using -DARP). The distribution binary was compiled with arp
- wildcarding.
-
- If you do not have arp's programmers bindings, or if you do not wish to
- have wildcards, I have put in numerous [ugly-looking] #ifdef's throughout
- the code, so that it will compile without arp stuff as well. The
- executables I use do not have the wildcarding because I use Matt's
- (Drew Manxified) shell that expands the wildcards already.
-
- Acknowledgements:
-
- If you thought your silly little example of Amiga programming is not
- worth publicly releasing, think again. This whole program is made of
- various hacked up examples, and has been very instructive for me to
- write! Please give out any examples you think could be remotely useful,
- as they probably are to someone. I hope that maybe this hack will be of
- use to someone as an example (even though it is a mess).
-
- I would like to thank Matt Dillon (again) for his shell, from which
- I hacked the remove routines and the date setting routines.
- Thanks also to Chuck McManis for the GetVolume example from Fish 56.
- Thanks to Doug Tittle for the initial inspiration for this program.
- And finally, thanks to Rob Peck for his book, "Programmer's Guide to
- the Amiga" from which most of the know-how in this program was
- learned.
-
- Files:
-
- ReadMe rwed 6392 13 27-Apr-89 22:01:43
- cp rwed 13864 28 27-Apr-89 21:53:41
- makefile arwed 1099 3 23-Apr-89 21:56:40
- mv.c arwed 39338 78 24-Apr-89 00:30:35
- mvtest.sh arwed 5812 12 23-Apr-89 22:09:09
- 139 Blocks, 66505 Bytes used in 5 files
-
- Revision History:
-
- 1.1
- - added in c, m and x options to allow one executable and different
- actions using a shell's alias mechanism. (ie. alias cp mv -c)
- - added d option to remove directories but only if they are empty
- (as in the behaviour of AmigaDOS Delete)
- - fixed problem with copying 0 byte files
- - fixed problem with moving a file to itself with different
- capitalization (mv foo Foo)
- - detects much better if there is an attempt to copy a file to itself
- - uses *much* less stack space (major problem with 1.0)
- - somewhat smaller size (but now Manx dependant...)
-
- 1.0
- - initial effort
-
- Please redirect any comments, criticisms or spare Swimsuit Issues
- of Sports Illustrated to:
-
- Edwin Hoogerbeets
- Usenet: edwin@watcsc.waterloo.edu (May '89 to Aug '89)
- CIS: 72647,3675 (any time at all)
-
-
-
-
-